# models/token_models.py
from .base import db, BaseModel

class RevokedToken(BaseModel):
    """已撤销的JWT令牌存储模型"""
    __tablename__ = "revoked_tokens"
    
    jti = db.Column(db.String(120), nullable=False)  # JWT ID
    
    @staticmethod
    def is_jti_blacklisted(jti):
        """检查令牌是否已被撤销"""
        revoked = RevokedToken.query.filter_by(jti=jti).first()
        return bool(revoked)